{% extends 'base.html' %}
{% load static %}
{% block title %}执行任务{% endblock %}
{% block content %}
<ul class="nav nav-tabs">
    <li class="active"><a href="#host" data-toggle="tab">主机</a></li>
    <li><a href="#hostgroup" data-toggle="tab">主机组</a></li>
</ul>
<form action="" method="post" style="margin-top: 10px">
    {% csrf_token %}
    <div class="tab-content">
        <div class="tab-pane active fade in form-group" id="host">
            <select class="form-control" name="server">
                <option value="">无</option>
                {% for host in hosts %}
                    <option value="{{ host.ipaddr }}">{{ host.hostname }}</option>
                {% endfor %}
            </select>
        </div>
        <div class="tab-pane fade form-group" id="hostgroup">
            <select class="form-control" name="hostgroup">
                <option value="">无</option>
                {% for group in groups %}
                    <option value="{{ group.groupname }}">{{ group.groupname }}</option>
                {% endfor %}
            </select>
        </div>
    </div>
    <table class="table table-bordered table-hover table-striped">
        <tr class="info text-center">
            <td>模块</td>
            <td>参数</td>
        </tr>
        {% for module in modules %}
            <tr>
                <td>
                    <div class="radio">
                        <label>
                            <input type="radio" name="module" value="{{ module.module_name }}">{{ module.module_name }}
                        </label>
                    </div>
                </td>
                <td>
                    <ul class="list-unstyled">
                        {% for arg in module.argument_set.all %}
                            <li>
                                <div class="radio">
                                    <label>
                                        <input name="argument" value="{{ arg.argument_text }}" type="radio">{{ arg.argument_text }}
                                    </label>
                                </div>
                            </li>
                        {% endfor %}
                    </ul>
                </td>
            </tr>
        {% endfor %}
    </table>
    <div class="form-group">
        <input class="btn btn-primary center-block" type="submit" value="执 行">
    </div>
</form>
{% endblock %}
